package com.masterclient.app;

import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.callback.NavCallback;
import com.alibaba.android.arouter.launcher.ARouter;
import com.eoner.managerlibrary.router.AroutePath;

public class SchemeFilterActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //直接通过ARouter处理外部Uri
        Uri uri = getIntent().getData();
        if (uri != null) {
            ARouter.getInstance().build(uri).navigation(this, new NavCallback() {
                @Override
                public void onArrival(Postcard postcard) {
                    finish();
                }

                @Override
                public void onLost(Postcard postcard) {
                    super.onLost(postcard);
                    ARouter.getInstance().build(AroutePath.MAIN_ACTIVITY).navigation(SchemeFilterActivity.this);
                    finish();
                }
            });
        } else {
            ARouter.getInstance().build(AroutePath.MAIN_ACTIVITY).navigation(this);
            finish();
        }
    }

}
